//初始化中间件

module.exports = options => {
  return async (ctx, next) => {
    ctx.returnBody = (code = 200, msg = '', data = {}) => {
      ctx.status = code;
      ctx.body = { code, msg, data, time: Math.floor(Date.now())};
      return;
    }
    await next();
  }
};
